package com.maidshop.fp.controller;

import com.maidshop.fp.domain.FileUpload;
import com.maidshop.fp.service.impl.FileServiceImpl;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import javax.annotation.Resource;

@RestController
@RequestMapping("/fileUpload")
public class FileController {

    @Resource
    private FileServiceImpl fileServiceImpl;

    /**
     * 上传文件接口
     * @return
     */
    @PostMapping("/upload")
    public FileUpload upload(@RequestParam("file") MultipartFile file) {
        return fileServiceImpl.saveFile(file);
    }
}
